import React from "react";

class Time extends React.Component {
  state = {
    time: new Date().toLocaleTimeString()
  }
  render() {
    return (
      <div>
        <button onClick={() => this.setState({ time: new Date().toLocaleTimeString() })}>获取最新时间</button>
        <hr />
        时间: {this.state.time}
      </div >
    )
  }
}
export default Time